package com.lagou.eduorderboot.rbbit;

import com.lagou.eduorderboot.entity.SmsVo;
import com.lagou.eduorderboot.sms.SmsService;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class OrderRever {

    @Autowired
    private SmsService smsService;

    @RabbitListener(queues = "${spring.rabbitmq.queue}")
    public void process(SmsVo smsVo){
        System.out.println ("得到通知，开始发送 = " + smsVo);

        //调用发送短信
        smsService.sendSms (smsVo.getPhone (),smsVo.getCourseName ());
    }
}
